package com.roc.template.mongo.service.impl;

import com.roc.template.activiti.dto.HistoryProcess;
import com.roc.template.activiti.dto.LeaveTask;
import com.roc.template.base.PageBean;
import com.roc.template.mongo.base.BaseServiceImpl;
import com.roc.template.mongo.dao.LeaveDao;
import com.roc.template.mongo.model.LeaveApply;
import com.roc.template.mongo.service.LeaveService;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class LeaveServiceImplImpl extends BaseServiceImpl<LeaveApply> implements LeaveService {

    private LeaveDao leaveDao;

    @Resource
    public void setFileDirectoryDao(LeaveDao leaveDao) {
        this.leaveDao = leaveDao;
        super.setBaseDao(leaveDao);
    }

    @Override
    public ProcessInstance startWorkflow(LeaveApply apply, String userid, Map<String, Object> variables) {
        return leaveDao.startWorkflow(apply,userid,variables);
    }

    @Override
    public PageBean<LeaveTask> getMyTaskList(String userid, int firstrow, int rowcount) {
        return leaveDao.getMyTaskList(userid,firstrow,rowcount);
    }

    @Override
    public int getMyAllTask(String userid) {
        return leaveDao.getMyAllTask(userid);
    }

    @Override
    public PageBean<HistoryProcess> getHistory(String openId, int pageNum, int pageSize) {
        return leaveDao.getHistory(openId,pageNum,pageSize);
    }
}
